<template>
	<view class="container">
		<view class="department" v-for="item in departmentInfo">
			<view class="department_img">
				<image :src="item.img" mode=""></image>
			</view>
			<view class="department_info">
				<view class="department_name">
					<!-- <uni-tag type="primary" inverted :text="item.name"></uni-tag>
					<uni-tag type="primary" inverted :text="'主任:'+item.head"></uni-tag>
					<uni-tag type="primary" inverted :text="'挂号费:￥'+item.registrationFee"></uni-tag> -->
					<!-- <uni-tag type="primary" inverted text="感冒科"></uni-tag> -->
					{{item.name}}
				</view>
				<view class="department_detail">
					{{item.descption}}
					
				</view>
				<view class="department_select" @click="handleToDoctor(item)">
					点击查看
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				departmentInfo: []
			}
		},
		onLoad() {
			this.getDepartment()
		},
		methods: {
			handleToDoctor(item) {
				if(this.$store.state.m_user.token){
					uni.setStorageSync('registrationFee',item.registrationFee)
					uni.navigateTo({
						url: `../doctor/doctor?id=${item.id}`
					})
				}else{
					uni.$showMsg('请登录!')
				}
			},
			getDepartment() {
				uni.$http.post('/user-server/api/department/v1/listAll', {
					"page": 1,
					"size": 100000
				}).then(res => {
					this.departmentInfo=JSON.parse(JSON.stringify(res.data.data.current_data))
					
					console.log(this.departmentInfo)
				})
			}
		}
	}
</script>

<style scoped>
	.container {
		padding: 20rpx;
		background-color: #ffffff;
	}

	.department {
		/* height: 250rpx; */
		display: flex;
		margin-bottom: 10rpx;
		border-bottom: 5rpx solid #fff;
		border-radius: 15rpx;
		box-shadow: 0px 0px 5px 2px rgba(208, 208, 208, 0.5);
	}

	.department_img {
		width: 30%;
		height: 250rpx;
		border-radius: 15rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		
	}

	.department_img image {
		height: 230rpx;
		border-radius: 15rpx;
		width: 100%;
		
	}

	.department_info {
		width: 70%;
		padding-left: 20rpx;
		padding-top: 10rpx;
	}

	.department_name {
		height: 50rpx;
		font-size: 40rpx;
		font-weight: bold;
	}

	.department_detail {
		border: solid 1rpx #fff;
		height: 150rpx;
		border-radius: 6rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
		word-wrap:break-word ;
		line-height: 50rpx;
	}

	.department_select {
		height: 50rpx;
		width: 170rpx;
		text-align: center;
		line-height: 50rpx;
		/* font-size: 12rpx; */
		float: right;
		color: #FFFFFF;
		border-radius: 10rpx;
		
		/* background-color: rgb(112,241,170); */
		background-image: linear-gradient(90deg, rgb(92, 197, 241) 30%, rgb(0, 144, 201) 100%);


	}
</style>
